<include file="DormChange:header"/>
<body>
<div class="wraper">
    <div class="load">
        <img class="load-bee" src="/assets/base/dormchange/images/load-bee.png">
    </div>
	<div class="head clearfix">
		<a href="javascript:history.go(-1);" class="iconfont icon-zuo pull-left"></a>
		<span class="head-name pull-left">申请详情</span>
		<if condition="$type neq 1">
		<a href="{BEESCRM::U('/Base/DormChange/index',array('wechat_id'=>$wechat_id))}" class="iconfont icon-shouye pull-left text-right"></a>
		<else />
		<a href="{BEESCRM::U('/Base/DormChange/appManagerOutList',array('wechat_id'=>$wechat_id))}" class="iconfont icon-shouye pull-left text-right"></a>
		</if>
	</div>
	<div class="express">
		<div class="logistics">
			<if condition="$data['status'] eq 7">
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">已取消</span></p>
					<p>{BEESCRM:$data['cancel_time']|date="Y-m-d H:i",###}</p>
					<p>有问题联系 855555555</p>
					<span class="circle"></span>
				</div>
			</div>
			</if>
			<if condition="$data['status'] egt 6 && !empty($data['manager_nopass2'])">
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">调入申请被拒绝</span></p>
					<p>{BEESCRM:$data['manager_nopass2']|date="Y-m-d H:i",###}</p>
					<p>{BEESCRM:$data['to_community_name']}{BEESCRM:$data['to_building_name']}管理员拒绝调入申请</p>
					<span class="circle"></span>
				</div>
			</div>
			</if>
			<if condition="$data['status'] egt 5 && !empty($data['manager_pass2'])">
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">调入申请已通过</span></p>
					<p>{BEESCRM:$data['manager_pass2']|date="Y-m-d H:i",###}</p>
					<p>{BEESCRM:$data['to_community_name']}{BEESCRM:$data['to_building_name']}管理员已通过该调入申请</p>
					<span class="circle"></span>
				</div>
			</div>
			</if>
			<if condition="$data['status'] egt 4 && !empty($data['error_time2'])">
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">调入申请失败</span></p>
					<p>{BEESCRM:$data['error_time2']|date="Y-m-d H:i",###}</p>
					<p>有问题联系 855555555</p>
					<span class="circle"></span>
				</div>
			</div>
			</if>
			<if condition="$data['status'] egt 3 && !empty($data['manager_nopass1'])">
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">调出申请被拒绝</span></p>
					<p>{BEESCRM:$data['manager_nopass1']|date="Y-m-d H:i",###}</p>
					<p>{BEESCRM:$data['community_name']}{BEESCRM:$data['building_name']}管理员拒绝调入申请</p>
					<span class="circle"></span>
				</div>
			</div>
			</if>
			<if condition="$data['status'] egt 2 && !empty($data['manager_pass1'])">
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">调出申请已通过</span></p>
					<p>{BEESCRM:$data['manager_pass1']|date="Y-m-d H:i",###}</p>
					<p>{BEESCRM:$data['community_name']}{BEESCRM:$data['building_name']}管理员已通过该调出申请</p>
					<span class="circle"></span>
				</div>
			</div>
			</if>
			<if condition="$data['status'] egt 1 && !empty($data['error_time'])">
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">调出申请失败</span></p>
					<p>{BEESCRM:$data['error_time']|date="Y-m-d H:i",###}</p>
					<p>有问题联系 855555555</p>
					<span class="circle"></span>
				</div>
			</div>
			</if>
			<div class="logistics-list">
				<div class="log">
					<p class="tb-mode"><span class="total tb-cell">申请已提交</span></p>
					<p>{BEESCRM:$data['create_time']|date="Y-m-d H:i",###}</p>
					<p>申请从{BEESCRM:$data['community_name']}{BEESCRM:$data['building_name']}{BEESCRM:$data['dorm_name']}调至{BEESCRM:$data['to_community_name']}{BEESCRM:$data['to_building_name']}{BEESCRM:$data['to_dorm_name']}</p>
					<span class="circle"></span>
				</div>
			</div>
			<div class="logistics-list">
				<div class="log detail">
					<p class="tb-mode"><span class="total tb-cell">详情</span></p>
					<p>期望调换至：{BEESCRM:$data['to_community_name']}{BEESCRM:$data['to_building_name']}</p>
					<span class="circle"></span>
				</div>
			</div>
			<input type="hidden" id="log_id" value="{BEESCRM:$data['log_id']}">
			<input type="hidden" id="status" value="{BEESCRM:$data['status']}">
			<if condition="$type neq 1">
			<div class="btn-box half-btn">
				<if condition="in_array($data['status'],array(0,1,2,3,4,6))">
				<a href="#" class="btn" id="cancel">取消申请</a>
				</if>
				<a href="{BEESCRM::U('/Base/DormChange/appStudentList',array('wechat_id'=>$wechat_id))}" class="btn white-btn">返回</a>
			</div>
			<else />
			<div class="btn-box half-btn">
				<if condition="in_array($data['status'],array(0,2))">
				<a href="#" class="btn" id="pass">审核通过</a>
				<a href="#" class="btn white-btn" id="nopass">审核不通过</a>
				<else />
				<a href="{BEESCRM::U('/Base/DormChange/appManagerOutList',array('wechat_id'=>$wechat_id))}" class="btn white-btn">返回</a>
				</if>
			</div>
			</if>
		</div>
	</div>
	<div class="bottom-box">
		<p class="copyright">杭州青橄榄网络技术有限公司 技术支持</p>
	</div>
</div>
<include file="DormChange:commonJs"/>
<script>
	var height = $(document).height();
	var bottombox_height = $('.bottom-box').outerHeight();
	$('.wraper').css("minHeight",height);
	$('.logistics').css("paddingBottom",bottombox_height);


	$(function(){
		var height = $(document).height();
		var height_head = $('.head').outerHeight();
		var contain_h = height - height_head;
		$('.logistics').css("minHeight",contain_h);
	});

	$(window).load(function(){
		$('.load').hide();
	});
	<if condition="$type neq 1">
	$('#cancel').click(function(){
		var log_id = $('#log_id').val();
		$.ajax({
			type:'post',
			url:'/Base/DormChange/changeStatus',
			data:{'log_id':log_id,'status':7},
			dataType:'json',
			success:function(data){
				if(data.status == 'S'){
					$.alert('success',data.message);
					setTimeout(function(){
						location.href = data.url;
					},3000);
				}else{
					$.alert('error',data.message);
				}
			},
			error:function(){
				$.alert('error','通讯错误');
			},
		});
	});
	<else />
	//审核通过
	$('#pass').click(function(){
		var log_id = $('#log_id').val();
		var nowStatus = $('#status').val();
		if(nowStatus == 0){
			status = 2;
		}else if(nowStatus == 2){
			status = 5;
		}
		$.ajax({
			type:'post',
			url:'/Base/DormChange/changeStatus',
			data:{'log_id':log_id,'status':status},
			dataType:'json',
			success:function(data){
				$.alert('success',data.message);
				setTimeout(function(){
					location.href = data.url;
				},3000);
			},
			error:function(){
				$.alert('error','通讯错误');
			},
		});
	});
	//审核不通过
	$('#nopass').click(function(){
		var log_id = $('#log_id').val();
		var nowStatus = $('#status').val();
		if(nowStatus == 0){
			status = 3;
		}else if(nowStatus == 2){
			status = 6;
		}
		$.ajax({
			type:'post',
			url:'/Base/DormChange/changeStatus',
			data:{'log_id':log_id,'status':status},
			dataType:'json',
			success:function(data){
				$.alert('success',data.message);
				setTimeout(function(){
					location.href = data.url;
				},3000);
			},
			error:function(){
				$.alert('error','通讯错误');
			},
		});
	});
	</if>
</script>
</body>
</html>